package com.zyh.work3

object WorkTest7 {
  def main(args: Array[String]): Unit = {
    var list: List[Worker] = List()
    list = list:+new Worker("zhang3",18,3000)
    list = list:+new Worker("li4",25,3500)
    list = list:+new Worker("wang5",22,3200)
    var count = 0
    var totalSalary = 0.0
    var strName = "wang52"
    var money = 3000.0
    var bool = false
    for(item<-list) {
      totalSalary += item.salary
      if(item.name.equals(strName)){
        println(item)
        bool = true
      }
      if(item.salary>money){
        println(item)
      }
    }
    if(bool == false) println("不存在")
    println(s"AvgSalary = ${totalSalary/list.size}")


  }
}
